package com.aaa.ssm.util;

/**
 * @ fileName:ResultFile
 * @ description:
 * @ author:wk
 * @ createTime:2023/10/9 20:15
 * @ version:1.0.0
 */

public class ResultFile<T> {
    private String code;
    private String msg;
    private T data;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public ResultFile() {
    }

    public ResultFile(T data) {
        this.data = data;
    }

    public static ResultFile success() {
        ResultFile result = new ResultFile<>();
        result.setCode("0");
        result.setMsg("成功");
        return result;
    }

    public static <T> ResultFile<T> success(T data) {
        ResultFile<T> result = new ResultFile<>(data);
        result.setCode("0");
        result.setMsg("成功");
        return result;
    }

    public static ResultFile error(String code, String msg, Object o) {
        ResultFile resultFile= new ResultFile();
        resultFile.setCode(code);
        resultFile.setMsg(msg);
        return resultFile;
    }
}
